######################################################## 
## Mod Title:   ezPortal Admin for phpBB2 with ezportal_admin_db_install - EM Friendly
## MOD Author: Marcus Thiel <thundercat@die-pretorianer.de>
## Updating Author: Willie Yaw  <cyborg@cyborgworks.com> www.die-pretorianer.de
## MOD Description:  This mod will add a small administration menu for the 
## ezPortal from Smartor
##
## MOD Version: 1.0.5
## 
## Author ezPortal: Smartor <smartor_xp@hotmail.com> - http://smartor.is-root.com
## 
## Installation Level:  easy
## Installation Time:  4-6 Minutes 
## Files To Edit: 2
## 		 		  portal.php
##	  			  language/lang_english/lang_admin.php
##
## Included Files: 3
## 				   admin/admin_portal.php
##	   			   templates/subSilver/admin/portal_config_body.tpl
##				   ezportal_admin_db_install.php
##
################################################################# 
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any ## Non-Official phpBB Sites 
################################################################# 
## 
## Author Note: 
##	
##	I hope you enjoy this mod, i try to add more function in the 
##      future.
##	This is my first mod. If you find any bugs please send me an email.
##	The template uses classes from the fisubice template from 
##      www.forumimages.com.
##	Maybe you have to change some of the classes to get this template ##      work with
##	the subSilver
## 
#################################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files 
## Related To This MOD 
################################################################# 
##
## Revision History:
##
## v1.0.0
##	- Initial Release
##--------------------------------------------------------------
## January 2nd 2003   
##
##  v 1.0.3 Updated by Willie Yaw {aka} Cyborg <cyborg@cyborgworks.com>
##
##  1.added ezportal_admin_db_install.php and made minor change to 
##   portal_value
##   changed from  
##   portal_value ' VARCHAR( 255 ) NOT NULL ,
##   to
##   portal_value ' TEXT NOT NULL , "so as not to limit Welcome message
##   to 255 characters"
##   
##  2. made minor changes to portal_config_body.tpl
##   made Welcome Message input box bigger and with scroll bar
##   to make editing much easier.
##
##
##
#################################################################
#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#
If EM was not able to run the SQL queries for you that are included in
the MOD script, then you must do the following in order to complete the MOD
install.  This should not be necessary in most instances though

copy the included ezportal_admin_db_install.php file to the root of your
phpBB forum folder then run it from your browser.  The path to the file 
in your browser could look similar to this:
       
http://yourdomain.com/phpBB2/ezportal_admin_db_install.php

After successfully updating your database, delete the ezportal_admin_db_install.php 
file from the root of your phpBB forum folder... 
#
#-----[ COPY ]------------------------------------------
#       
copy admin/admin_portal.php to admin/admin_portal.php
copy templates/subSilver/admin/portal_config_body.tpl to templates/subSilver/admin/portal_config_body.tpl
#
#-----[ SQL ]------------------------------------------
#
CREATE TABLE 'phpbb_portal' (
  'portal_name' VARCHAR( 255 ) NOT NULL ,
  'portal_value' TEXT  NOT NULL ,
  PRIMARY KEY ( 'portal_name' ) 
);

INSERT INTO 'phpbb_portal' ( 'portal_name' , 'portal_value' ) VALUES ('welcome_text', 'Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^');
INSERT INTO 'phpbb_portal' ( 'portal_name' , 'portal_value' ) VALUES ('number_of_news', '5');
INSERT INTO 'phpbb_portal' ( 'portal_name' , 'portal_value' ) VALUES ('news_length', '200');
INSERT INTO 'phpbb_portal' ( 'portal_name' , 'portal_value' ) VALUES ('news_forum', '1');
INSERT INTO 'phpbb_portal' ( 'portal_name' , 'portal_value' ) VALUES ('poll_forum', '1');
INSERT INTO 'phpbb_portal' ( 'portal_name' , 'portal_value' ) VALUES ('number_recent_topics', '10');
INSERT INTO 'phpbb_portal' ( 'portal_name' , 'portal_value' ) VALUES ('last_seen', '5');
#
# 
#-----[ OPEN ]------------------------------------------ 
# 
portal.php
# 
#-----[ FIND ]------------------------------------------ 
# 
$CFG['welcome_text'] =
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$CFG['welcome_text'] =

# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
# 
// $CFG['welcome_text'] =
# 
#-----[ FIND ]------------------------------------------ 
# 
$CFG['number_of_news'] =
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$CFG['number_of_news'] =
# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
# 
// $CFG['number_of_news'] =
# 
#-----[ FIND ]------------------------------------------ 
# 
$CFG['news_length'] =
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$CFG['news_length'] =
# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
# 
// $CFG['news_length'] =
# 
#-----[ FIND ]------------------------------------------ 
# 
$CFG['news_forum'] =
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$CFG['news_forum'] =
# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
# 
// $CFG['news_forum'] =
# 
#-----[ FIND ]------------------------------------------ 
# 
$CFG['poll_forum'] =
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
$CFG['poll_forum'] =
# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
# 
// $CFG['poll_forum'] =
# 
#-----[ FIND ]------------------------------------------ 
# 
# Only if you have installed, the "number of recent topics" block !
$CFG['number_recent_topics'] =
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
# Only if you have installed, the "number of recent topics" block !
$CFG['number_recent_topics'] =
# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
# 
// $CFG['number_recent_topics'] =
# 
#-----[ FIND ]------------------------------------------ 
# 
# Only if you have installed, the "last seen" block !
$CFG['last_seen'] =
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
# Only if you have installed, the "last seen" block !
$CFG['last_seen'] =
# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
# 
// $CFG['last_seen'] =
# 
#-----[ FIND ]------------------------------------------ 
# 

if( $total_users == 0 )
{
	$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
	$l_total_user_s = $lang['Registered_user_total'];
}
else
{
	$l_total_user_s = $lang['Registered_users_total'];
}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// Read Portal Configuration from DB
define('PORTAL_TABLE', $table_prefix.'portal');

$CFG = array();
$sql = "SELECT * FROM " . PORTAL_TABLE;

if( !($result = $db->sql_query($sql)) )
{
	message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
	$CFG[$row['portal_name']] = $row['portal_value'];
}

# 
#-----[ FIND ]------------------------------------------ 
# 
# Only if you have installed, the "last seen" block !
// 
// last seen hack 
// 
   $sql = "SELECT username, user_id, user_lastvisit FROM phpbb_users WHERE user_id > 0 AND user_level <> 1 ORDER BY user_lastvisit DESC LIMIT 10"; 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

// 
// last seen hack 
// 
	$sql = "SELECT username, user_id, user_lastvisit FROM " . USERS_TABLE . " WHERE user_id > 0 AND username <> 'Anonymous' ORDER BY user_lastvisit DESC LIMIT " . $CFG['last_seen']; 

# 
#-----[ OPEN ]------------------------------------------ 
# 

language/lang_english/lang_admin.php

# 
#-----[ FIND ]------------------------------------------ 
# 
?>
#
#-----[ BEFORE, ADD ]-----------------------------------
#
//
// mod : ezportal Admin
//
$lang['EZPortal_Config'] = 'EZPortal Configuration';
$lang['EZPortal_Portal_settings'] = 'EZPortal Settings';
$lang['Welcome_Text'] = 'Welcome Message';
$lang['Number_of_News'] = 'Number of News';
$lang['News_length'] = 'News length';
$lang['News_Forum'] = 'News forum(s)';
$lang['Poll_Forum'] = 'Poll forum(s)';
$lang['Number_Recent_Topics'] = 'Number of recent topics';
$lang['Last_Seen'] = 'Last seen users on forum';
$lang['Comma'] = 'Separate forum ID(s) with a comma';
//
//  END ezportal Admin
//

# 
#-----[ OPEN ]------------------------------------------ 
# 

language/lang_german/lang_admin.php

# 
#-----[ FIND ]------------------------------------------ 
# 
?>
#
#-----[ BEFORE, ADD ]-----------------------------------
#
//
// mod : ezportal Admin
//
$lang['General_Portal_Config'] = '  EZPortal Konfiguration';
$lang['General_Portal_settings'] = '  EZPortal einstellungen';
$lang['Welcome_Text'] = 'Willkommensnachricht';
$lang['Number_of_News'] = 'Anzahl der News';
$lang['News_length'] = 'News lnge';
$lang['News_Forum'] = 'News forum(s)';
$lang['Poll_Forum'] = 'Poll forum(s)';
$lang['Number_Recent_Topics'] = 'Anzahl der letzten Beitrge';
$lang['Last_Seen'] = 'Anzahl der letzten Besucher';
$lang['Comma'] = 'Separate forum ID(s) with a comma';
//
//  END ezportal Admin
//

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM